import Vue from 'vue'
import router from './router'
import ElementUI from "element-ui"
import "element-ui/lib/theme-chalk/index.css";
import './assets/css/global.css'
import './plugins/element'
//第三方插件库
import ZkTable from 'vue-table-with-tree-grid'
//引入字体图标库
import './assets/fonts/iconfont.css'

import App from './App'
//导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";


//引入axios
import axios from 'axios'
//配置路径
axios.defaults.baseURL = "http://127.0.0.1:8888/api/private/v1/";
axios.interceptors.request.use(config => {
  // console.log(config)
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
Vue.prototype.$http = axios
Vue.config.productionTip = false
Vue.use(ElementUI)
//全局注册
Vue.use(VueQuillEditor)
//封装一个时间的过滤器
Vue.filter('dateFormat', function (time) {
  let t = new Date(time)
  //获取时分秒
  let y = t.getFullYear()
  let m = (t.getMonth() + 1 + '').padStart(2, '0')
  let d = (t.getDate() + '').padStart(2, '0')
  let h = (t.getHours() + '').padStart(2, '0')
  let min = (t.getMinutes() + '').padStart(2, '0')
  let s = (t.getSeconds() + '').padStart(2, '0')
  return `${y}-${m}-${d} ${h}:${min}:${s}`
})
//使用第三方插件库
Vue.component('tree-table', ZkTable)
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})
